<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			var a = 2; //值
			var n = 3; //叠数
			var num = 0; // 存储每次获得的叠数
			var sum = 0;//存储每次叠数的和
			for (var i = 1; i <= n; i++) {
				num = num * 10 + a; //每一次循环的叠数
				sum += num;//叠数的和
				console.log(sum);
			}
		</script>
	</body>
</html>
